<template>
  <div class="scrollContainer" ref="scroll">
    <slot />
  </div>
</template>
<script>
  import {
    _totall
  } from '@/utils/throttle'
  import {
    setTimeout
  } from 'timers';
  export default {
    name: 'scroll',
    mounted() {
      window.addEventListener('scroll', this.scrollEnd);
    },
    methods: {
      scrollEnd(e) {
        setTimeout(() => {
          let scrollTop = document.documentElement.scrollTop || document.body.scrollTop || window.pageYOffset;
          // let clientHeight = document.documentElement.clientHeight || document.body.clientHeight || window.clientHeight;
          // let scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight || window.scrollHeight;
          this.$emit('scroll', scrollTop);
          // if (scrollHeight - clientHeight - scrollTop < 100) {
          //   this.$emit('scrollEnd');
          // }
        }, 1000)
      }
      }
    };

</script>

<style lang="css">
  .scrollContainer {
    width: 1200px!important;
    height: 100%;
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1;
  }

</style>
